package cn.edu.sysu.service;

import java.io.Serializable;
import java.sql.SQLException;
import java.util.List;

import org.apache.velocity.VelocityContext;

import cn.edu.sysu.dao.ProblemDao;
import cn.edu.sysu.dto.ProblemDto;
import cn.edu.sysu.util.Transaction;
import cn.edu.sysu.util.TransactionRead;

public class ProblemService implements Serializable{

	/**
	 *
	 */
	private static final long serialVersionUID = 9050503301829131623L;
	ProblemDao pDao = ProblemDao.INSTANCE;
	Transaction read = TransactionRead.INSTANCE;

	public ProblemService(){

		System.out.println("Init Problem Service");
	}

	public String getHello(){
		return "hello";
	}

	public ProblemDto getProblem(int problem_id) throws SQLException{
		ProblemDto problem = pDao.getProblemById(read, problem_id);

		return problem;
	}

	public List<ProblemDto> getProblemList() throws SQLException{
		return pDao.getAllProblems(read);
	}

}
